﻿cmake_minimum_required(VERSION 2.8)
project(geos)
file(GLOB_RECURSE lib_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
set(lib_hdrs capi/geos_c.h include/geos.h)
set(CMAKE_DEBUG_POSTFIX "D")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} include)
add_definitions(/DUSE_UNSTABLE_GEOS_CPP_API)
add_library(${PROJECT_NAME} SHARED ${lib_srcs})
target_compile_definitions(${PROJECT_NAME} PRIVATE GEOS_DLL_EXPORT)
install(DIRECTORY include/geos DESTINATION include)
install(FILES ${lib_hdrs} DESTINATION include)
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
install(EXPORT ${PROJECT_NAME}-targets DESTINATION lib/cmake FILE ${PROJECT_NAME}-config.cmake)

if(BUILD_STATIC)
  add_library(${PROJECT_NAME}S STATIC ${libc_srcs} ${lib_srcs})
  install(TARGETS ${PROJECT_NAME}S EXPORT ${PROJECT_NAME}S-targets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib)
  install(EXPORT ${PROJECT_NAME}S-targets DESTINATION lib/cmake FILE ${PROJECT_NAME}S-config.cmake)
endif()

